Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop reference to detached datachannels #2696

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Mar 4, 2024

This allows users of detached datachannels to garbage collect resources associated with the datachannel and the sctp stream. There is no functional change here.

Fixes #2672

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

Attention: Patch coverage is 86.48649% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 76.39%. Comparing base (a8c02b0) to head (2444e36).

Files Patch % Lines
sctptransport.go 64.28% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2696   +/-   ##
=======================================
  Coverage   76.38%   76.39%           
=======================================
  Files          87       87           
  Lines        9923     9947   +24     
=======================================
+ Hits         7580     7599   +19     
- Misses       1871     1875    +4     
- Partials      472      473    +1     
Flag Coverage Δ
go 77.92% <86.48%> (+<0.01%) ⬆️
wasm 64.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sukunrt sukunrt requested a review from Sean-Der March 4, 2024 09:02
@sukunrt sukunrt force-pushed the datachannel-reference branch 4 times, most recently from e2efe0a to 2268938 Compare March 4, 2024 09:55
Copy link

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. Thanks @sukunrt!

d.sctpTransport.lock.Lock()
n := len(d.sctpTransport.dataChannels)
j := 0
for i := 0; i < n; i++ {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does d.sctpTransport.dataChannels need to remain in order? Can you swap remove instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can. I just didn't want to change that property here.

@Sean-Der
Copy link
Member

Thank you so much @sukunrt! Really appreciate the tests :)

Rebasing + merging now

This allows users of detached datachannels to garbage collect
resources associated with the datachannel and the sctp stream.
There is no functional change here.
@Sean-Der Sean-Der merged commit 835ac3b into master Mar 25, 2024
17 checks passed
@Sean-Der Sean-Der deleted the datachannel-reference branch March 25, 2024 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PeerConnection should drop reference to datachannel when it's closed
3 participants